package com.ruoyi.sgsc.service.impl;

import java.util.List;

import com.ruoyi.sgsc.domain.shoppingcartdetial;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.sgsc.mapper.shoppingcartsMapper;
import com.ruoyi.sgsc.domain.shoppingcarts;
import com.ruoyi.sgsc.domain.shoppingcartdetial;
import com.ruoyi.sgsc.service.IshoppingcartsService;

/**
 * 购物车Service业务层处理
 * 
 * @author wy
 * @date 2024-09-29
 */
@Service
public class shoppingcartsServiceImpl implements IshoppingcartsService 
{
    @Autowired
    private shoppingcartsMapper shoppingcartsMapper;

    /**
     * 查询购物车
     * 
     * @param userId 用户id
     * @return 购物车
     */
    @Override
    public shoppingcarts selectshoppingcartIDByUserId(Long userId)
    {
        return shoppingcartsMapper.selectshoppingcartIDByUserId(userId);
    }

    /**
     * 根据userId获取购物车列表
     * @param userId
     * @return
     */
    public List<shoppingcartdetial>selectshoppingcartsByUserId(Long userId)
    {
        return shoppingcartsMapper.selectshoppingcartsByUserId(userId);
    }


    /**
     * 查询购物车列表
     * 
     * @param shoppingcarts 购物车
     * @return 购物车
     */
    @Override
    public List<shoppingcarts> selectshoppingcartsList(shoppingcarts shoppingcarts)
    {
        return shoppingcartsMapper.selectshoppingcartsList(shoppingcarts);
    }



    /**
     * 新增购物车
     * 
     * @param shoppingcarts 购物车
     * @return 结果
     */
    @Override
    public int insertshoppingcarts(shoppingcarts shoppingcarts)
    {
        return shoppingcartsMapper.insertshoppingcarts(shoppingcarts);
    }

    /**
     * 修改购物车
     * 
     * @param shoppingcarts 购物车
     * @return 结果
     */
    @Override
    public int updateshoppingcarts(shoppingcarts shoppingcarts)
    {
        return shoppingcartsMapper.updateshoppingcarts(shoppingcarts);
    }

    /**
     * 批量删除购物车
     * 
     * @param cartIds 需要删除的购物车主键
     * @return 结果
     */
    @Override
    public int deleteshoppingcartsByCartIds(Long[] cartIds)
    {
        return shoppingcartsMapper.deleteshoppingcartsByCartIds(cartIds);
    }

    /**
     * 删除购物车信息
     * 
     * @param cartId 购物车主键
     * @return 结果
     */
    @Override
    public int deleteshoppingcartsByCartId(Long cartId)
    {
        return shoppingcartsMapper.deleteshoppingcartsByCartId(cartId);
    }
}
